<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

// Route::get('think', function () {
//     return 'hello,ThinkPHP5!';
// });

// Route::get('hello/:name', 'index/hello');

// return [

// ];

use think\facade\Route;

// Route::rule('/a','home/index/index');

// Route::get('/a','home/index/index');

// 后台api路由
Route::domain('adminapi',function(){
    // 默认首页
    Route::get('/','adminapi/index/index');
    //获取验证码接口
    Route::get('/admin/captcha','adminapi/login/captcha')->allowCrossDomain();
    // 登录接口
    Route::post('login','adminapi/login/login')->allowCrossDomain();
    // 管理员接口
    Route::get("admin","adminapi/admin/index")->allowCrossDomain();
    // 修改用户列表接口
    Route::post("edit","adminapi/admin/edit")->allowCrossDomain();
    // 删除用户列表接口
    Route::post("delect","adminapi/admin/delect")->allowCrossDomain();
    // 商品表页面显示接口
    Route::get("goods","adminapi/Goods/index")->allowCrossDomain();
    // 权限列表接口
    Route::get('auth','adminapi/auth/index')->allowCrossDomain();
    
    Route::get('adminlist','adminapi/admin/index')->allowCrossDomain();
    
    Route::get('goods','adminapi/goods/index')->allowCrossDomain();
    // 文件上传
    Route::post('logo','adminapi/goods/upload')->allowCrossDomain();
    //
    Route::post('goods_save',"adminapi/goods/goods_save")->allowCrossDomain();
    // 商品分类
    Route::resource('categorys',"adminapi/categorys",[],['id'=>'\d+'])->allowCrossDomain();
});


// 前台api路由
Route::domain('homeapi',function(){
    // 默认首页
    Route::get('/','home/index/index');
    Route::get('/login','home/login/login');
    Route::get('/register','home/login/register');
    Route::get('/out',"home/login/out");
    Route::get('/useredit',"home/index/useredit");
});